package com.zttek.photosShareProject.modules.web.share;

import com.zttek.photosShareProject.common.base.MyBaseController;
import com.zttek.photosShareProject.common.myException.DBException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class CenterExceptionHandler extends MyBaseController{

//    @ExceptionHandler({DBException.class})
//    public ModelAndView somethingwrong(Exception ex){
//        ModelAndView mv = new ModelAndView("error");
//
//        mv.addObject("exception",ex);
//        return mv;
//    }

    @ExceptionHandler({Exception.class})
    @ResponseBody
    public Object somethingwrong(Exception ex){
        ex.printStackTrace();
        return renderError();
    }
}
